package com.demo;

import java.util.ArrayList;
import java.util.HashMap;

import com.demo.R;
import com.slidingmenu.lib.SlidingMenu;
import com.slidingmenu.lib.app.SlidingActivity;

import android.os.Bundle;
import android.app.Activity;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.widget.ListView;

public class HomeActivity extends FragmentActivity {

    
    private ListView mListView;
    private SlidingMenu SlidingMenu;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle("测试");

        // set the Above View
        setContentView(R.layout.activity_home);
        getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.activity_home, new SampleListFragment())
        .commit();
        
        SlidingMenu=new SlidingMenu(this);
        SlidingMenu.setMode(SlidingMenu.LEFT);
        SlidingMenu.setShadowWidthRes(R.dimen.shadow_width);
        SlidingMenu.setShadowDrawable(R.drawable.shadow);
        SlidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        SlidingMenu.setFadeDegree(0.35f);
        SlidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
        SlidingMenu.setMenu(R.layout.menu_frame);
        SlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
        getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.menu_frame, new SampleListFragment())
        .commit();
        
    }
    
    @Override
    public void onBackPressed() {
        if (SlidingMenu.isMenuShowing()) {
            SlidingMenu.showContent();
        } else {
            super.onBackPressed();
        }
    }

//    @Override
//    public boolean onCreateOptionsMenu(Menu menu) {
//        // Inflate the menu; this adds items to the action bar if it is present.
//        getMenuInflater().inflate(R.menu.activity_home, menu);
//        return true;
//    }

    

}
